<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Vue 测试实例 - 菜鸟教程(runoob.com)</title>
<script src="https://cdn.staticfile.org/vue/3.2.36/vue.global.min.js"></script>
</head>

<style>
  .cl1{
    width: 100px;
    height: 100px;
    border: 1px solid #000;
  }
  .cl2{
    background-color: brown;
  }
  .cl3{
    background-color: gray;
  }
</style>

<body>
<div id="hello-vue" class="demo">
  <div class="cl1" >1</div>
  <div class="cl1" class="cl2">2 错误</div>
  <div class="cl1 cl2">3</div>
  <div class="cl1" :class="{'cl2':isActive }">4</div>
  <div class="cl1" :class="{'cl2':isActive2 }">5</div>
  <button @click="changeClass">change</button>
  <div class="cl1" :class="{'cl2':isActive3 }">6</div>

</div>

<script>
var app = {
  data(){
    return {
      isActive: 0,
      isActive2: 1,
      isActive3: true
    }
  },
  methods:{
    changeClass:function() {
      this.isActive3 = !this.isActive3
      console.log("this.isActive3:",this.isActive3)
    }
  }
}

var vm =  Vue.createApp(app).mount('#hello-vue')


</script>
</body>
</html>
